package com.ky.controller;

import com.ky.Common.Result;
import com.ky.entity.Staff;
import com.ky.service.StaffService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@RequestMapping("/staff")
@RestController
@Slf4j
public class StaffController {


    @Autowired
    private StaffService service;
  //  @RequestMapping("/find")
    @GetMapping
    public List<Staff> findall(){
        return service.findall ();
    }

    //登录
    @PostMapping("/login")

    public Result login(String username, String password) {
        log.info ("员工登录{},{}", username,password);
        return service.login ( username,password);
    }

}
